<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<!--<h:outputStylesheet name="view.css" library="css"></h:outputStylesheet>
	<h:outputScript name="view.js" library="js"></h:outputScript>-->
	<h:outputStylesheet name="geral.css" library="css"></h:outputStylesheet>
	<title>Cadastro Funcionario</title>
</h:head>
<h:body>
		<div id="form_container">
			<div id="menu">
			<f:view>
				<h:form>
					<p:growl id="messages" />
					<p:menubar>

						<p:menuitem value="HOME " url="index.xhtml" />

						<p:submenu label="CADASTRO">
							<p:submenu label="Campus" icon="ui-icon-contact">
								<p:menuitem value="Novo" url="campus.xhtml?faces-redirect=true" />
								<p:menuitem value="Listar"
									url="campus-listar.xhtml?faces-redirect=true" />
							</p:submenu>
							<p:submenu label="Departamento" icon="ui-icon-contact">
								<p:menuitem value="Novo"
									url="setor.xhtml?faces-redirect=true" />
								<p:menuitem value="Listar"
									url="setor-listar.xhtml?faces-redirect=true" />
							</p:submenu>
							<p:submenu label="Funcionario" icon="ui-icon-contact">
								<p:menuitem value="Novo"
									url="funcionario.xhtml?faces-redirect=true" />
								<p:menuitem value="Listar"
									url="funcionario-listar.xhtml?faces-redirect=true" />
							</p:submenu>
							<p:submenu label="Curso" icon="ui-icon-contact">
								<p:menuitem value="Novo" url="curso.xhtml?faces-redirect=true" />
								<p:menuitem value="Listar"
									url="curso-listar.xhtml?faces-redirect=true" />
							</p:submenu>
						</p:submenu>
						<f:facet name="options"></f:facet>
					</p:menubar>

				</h:form>
			</f:view>
		</div>
		<div id="da-slider" class="da-slider">
			<img src="resources/images/banner.jpg" alt="" />
		</div>
		<!-- FIM BANNER-PRINCIPAL -->
		<!-- FIM MENU -->
	
	<div id="form_container">
		<h:form id="formulario">
			<p:panel id="pn" header="Cadastrar Funcionario">
				<h:panelGrid columns="4" cellpadding="4">

					<h:outputLabel for="primeNome" value="Nome:" />
					<p:inputText id="primeNome" label="Primeiro Nome"
						value="#{mbFuncionario.funcionario.nome}" required="true">
						<f:validateLength minimum="5" maximum="30"></f:validateLength>
					</p:inputText>

					<h:outputLabel for="cpf" value="CPF:" />
					<p:inputMask id="cpf" label="CPF"
						value="#{mbFuncionario.funcionario.cpf}" required="true"
						requiredMessage="Campo 'CPF' é obrigátorio"
						mask="999.999.999-99">
						<f:validateLength minimum="11" maximum="14"></f:validateLength>
					</p:inputMask>

					<h:outputLabel for="rg" value="RG:" />
					<p:inputText id="rg" label="RG"
						value="#{mbFuncionario.funcionario.rg}" required="true">
						<f:validateLength minimum="6" maximum="8"></f:validateLength>
					</p:inputText>

					<h:outputLabel for="telefone" value="Telefone:" />
					<p:inputMask id="fone" label="Telefone"
						value="#{mbFuncionario.funcionario.telefone}" required="true"
						requiredMessage="Campo 'TELEFONE' é obrigátorio"
						mask="(99)9999-9999">
						<f:validateLength minimum="10" maximum="14"></f:validateLength>
					</p:inputMask>

					<h:outputLabel for="celular" value="Celular:" />
					<p:inputMask id="celular" label="Celular"
						value="#{mbFuncionario.funcionario.celular}" required="true"
						requiredMessage="Campo 'CELULAR' é obrigátorio"
						mask="(99)9999-9999">
						<f:validateLength minimum="10" maximum="14"></f:validateLength>
					</p:inputMask>

					<h:outputLabel for="data_nascimento" value="Data de Nascimento:" />
					<p:calendar value="#{mbFuncionario.funcionario.dataNascimento}" />
					
					
					<h:outputLabel for="naturalidade" value="Naturalidade" />
					<p:inputText id="naturalidade" label="naturalidade" value="#{mbFuncionario.funcionario.naturalidade}"
						required="true">
						<f:validateLength minimum="2" maximum="50"></f:validateLength>
					</p:inputText>

					<h:outputLabel for="estadoCivil" value="Estado Civil:" />
					<p:selectOneMenu id="func" value="#{mbFuncionario.funcionario.estadoCivil}" effect="fade">  
			            <f:selectItem itemLabel="Selecione um" itemValue=""/>
			            <f:selectItems value="#{mbFuncionario.estadoCivil}"/>
			            <f:selectItem itemLabel="           " itemValue=""/>
			        </p:selectOneMenu>

					<h:outputLabel for="nomePai" value="Nome do Pai:" />
					<p:inputText id="nomePai" label="NomePai" value="#{mbFuncionario.funcionario.nomePai}"
						required="true">
						<f:validateLength minimum="2" maximum="30"></f:validateLength>
					</p:inputText>
					
					<h:outputLabel for="nomeMae" value="Nome do Mae:" />
					<p:inputText id="nomeMae" label="NomeMae" value="#{mbFuncionario.funcionario.nomeMae}"
						required="true">
						<f:validateLength minimum="2" maximum="30"></f:validateLength>
					</p:inputText>
					
					<h:outputLabel for="email" value="Email:" />
					<p:inputText id="email" label="Email" value="#{mbFuncionario.funcionario.email}"
						required="true">
						<f:validateLength minimum="2" maximum="30"></f:validateLength>
					</p:inputText>
					
					<h:outputLabel for="numero" value="Numero:" />
					<p:inputText id="numero" label="Número"
						value="#{mbFuncionario.funcionario.endereco.numero}" required="true">
						<f:validateLongRange maximum="9999" minimum="1"></f:validateLongRange>
					</p:inputText>

					<h:outputLabel for="bairro" value="Bairro:" />
					<p:inputText id="bairro" label="Bairro"
						value="#{mbFuncionario.funcionario.endereco.bairro}" required="true">
						<f:validateLength minimum="5" maximum="50"></f:validateLength>
					</p:inputText>

					<h:outputLabel for="rua" value="Rua" />
					<p:inputText id="rua" label="Rua" value="#{mbFuncionario.funcionario.endereco.rua}"
						required="true">
						<f:validateLength minimum="5" maximum="50"></f:validateLength>
					</p:inputText>

					<h:outputLabel for="cidade" value="Cidade:" />
					<p:inputText id="cidade" label="Cidade"
						value="#{mbFuncionario.funcionario.endereco.cidade}" required="true">
						<f:validateLength minimum="5" maximum="20"></f:validateLength>
					</p:inputText>

					<h:outputLabel for="cep" value="CEP:" />
					<p:inputMask id="cep" label="CEP"
						value="#{mbFuncionario.funcionario.endereco.cep}" required="true"
						requiredMessage="Campo 'CEP' é obrigátorio"
						mask="99999-999">
						<f:validateLength minimum="8" maximum="10"></f:validateLength>
					</p:inputMask>

					<h:outputText value="Funcao: " />  
			        <p:selectOneMenu value="#{mbFuncionario.funcionario.funcao.codigo}" effect="fade" required="true" requiredMessage="Escolha uma Funcao">  
			            <f:selectItem itemLabel="Selecione um" itemValue="" />  
			            <f:selectItems value="#{mbFuncionario.listarCargos}" var="funcao" itemLabel="#{funcao.descricao}" itemValue="#{funcao.codigo}"/>  
			        </p:selectOneMenu>
							
					<h:outputText value="Campus: " />
					<p:selectOneMenu value="#{mbFuncionario.funcionario.campus.codigo}" effect="fade" required="true" requiredMessage="Escolha um Campus">  
			            <f:selectItem itemLabel="Selecione um" itemValue="" />  
			            <f:selectItems value="#{mbCampus.colecaoCampus}" var="campus" itemLabel="#{campus.nome}" itemValue="#{campus.codigo}"/>  
			        </p:selectOneMenu>
					
					<h:outputLabel for="usuarioLogin" value="Login:" />
					<p:inputText id="usuarioLogin" label="Login" value="#{mbFuncionario.funcionario.usuario.login}"
						required="true">
						<f:validateLength minimum="1" maximum="20"></f:validateLength>
					</p:inputText>
					
					<h:outputLabel for="usuarioSenha" value="Senha:" />
					<p:password id="usuarioSenha" label="Senha" value="#{mbFuncionario.funcionario.usuario.senha}"
						required="true">
						<f:validateLength minimum="1" maximum="20"></f:validateLength>
					</p:password>
					
					<h:inputHidden value="#{mbFuncionario.funcionario.codigo}"></h:inputHidden>
					
					<h:panelGroup /><br/>
					<p:commandButton id="ajax" styleClass="ui-priority-primary"
						value="Salvar" 
						action="#{mbFuncionario.salvarFuncionario}" ajax="false" />

				</h:panelGrid>

				<p:messages id="messages" showDetail="true" autoUpdate="true"
					closable="true" />

			</p:panel>
		</h:form>
	</div>
	</div>
	<!-- <img id="bottom" src="../resources/images/bottom.png" alt=""></img>-->
</h:body>
</html>